package com.bbms.service.impl;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import com.bbms.dao.UserDao;
import com.bbms.entity.Page;
import com.bbms.entity.User;
import com.bbms.service.UserService;

/**
 * 用户管理业务类
 * @author Administrator
 */
@Service("UserServiceImpl")
public class UserServiceImpl implements UserService {

	@Resource(name="UserDaoImpl")
	private UserDao ud;
	
	/*
	 * 添加用户
	 * @see com.bbms.service.BaseService#add(java.lang.Object)
	 */
	@Override
	public void add(User t) {
		ud.save(t);
	}
	
	/*
	 * 修改用户
	 * @see com.bbms.service.BaseService#update(java.lang.Object)
	 */
	@Override
	public void update(User t) {
		ud.update(t);
	}
	
	/*
	 * 删除用户
	 * @see com.bbms.service.BaseService#delete(java.lang.Object)
	 */
	@Override
	public void delete(User t) {
		ud.delete(t);
	}
	
	/*
	 * 获取分页数据(无查询)
	 * @see com.bbms.service.BaseService#getPage(java.lang.Object)
	 */
	@Override
	public Page getPage(int currentPage, int pageSize) {
		Page page=ud.getPage(currentPage, pageSize);
		return page;
	}

	/*
	 * 根绝账号查询对应用户
	 * @see com.bbms.service.UserService#queryByAccount()
	 */
	@Override
	public List<?> queryByAccount(String account) {
		List<?> list=ud.queryByAccount(account);
		return list;
	}

	/* 
	 * 用户登录
	 * @see com.bbms.service.UserService#login(java.lang.String, java.lang.String)
	 */
	@Override
	public Map<?, ?> login(String account, String password) {
		
		Map<?, ?> message = ud.login(account, password);
		
		return message;
	}

	@Override
	public void updateUser(User user) {
		ud.updateUser(user);
	}

}
